ymaps.modules.define( 'DeliveryCalculator', ['util.defineClass'], function (provide, defineClass) { /** * @class DeliveryCalculator Расчет стоимости доставки. * @param {Object} map Экземпляр карты. */ function DeliveryCalculator (map) { this._map = map; this._startPoint = null; this._route = null; this._startPointBalloonContent; this._finishPointBalloonContent; this._parking = new ymaps.Placemark([37.863893,55.741554], {iconContent: 'P'}, {draggable: false}); this._map.geoObjects.add(this._parking); this._Points = []; this._Distance = 0; map.events.add('click', this._onClick, this); } defineClass(DeliveryCalculator, { /** * Создаем начальную точку маршрута. * Если точка создана, то обновляем координаты. * @param {Number[]} position Координаты точки. */ setStartPoint: function (position) { console.log('change start'); if (this._startPoint) { this._startPoint.geometry.setCoordinates(position); } else { // Создаем маркер с возможностью перетаскивания (опция `draggable`). // По завершении перетаскивания вызываем обработчик `_onStartDragEnd`. this._startPoint = new ymaps.Placemark(position, {iconContent: '1'}, {draggable: true}); this._startPoint.events.add('dragend', this._onStartDragEnd, this); this._startPoint.events.add('click',this.removeStart, this); this._map.geoObjects.add(this._startPoint); console.log(this._map.controls.indexOf("searchControl")); } this.geocode('start', position); }, removeStart: function(){ this._map.geoObjects.remove(this._startPoint); this._startPoint = null; this._setupRoute(); }, /** * добавляем промежуточную точку * @param {Number[]} position Координаты точки. */ addBetweenPoint: function (position,index,baloon){ if(this._Points[index]){ this._Points[index].geometry.setCoordinates(position); this._setupRoute(); } else { this._Points[index] = new ymaps.Placemark(position, {iconContent: index+3,hintContent: baloon}, {draggable: true}); this._Points[index].events.add('dragend', this._onBetweenDragEnd, this); this._Points[index].events.add('click',function(event){ this._map.geoObjects.remove(event.originalEvent.target); this._Points.splice( parseInt(event.originalEvent.target.properties._data.iconContent) - 3 , 1 ); for(i=0;i } else { $(".carChooseImgs_elem").show(); } // выключаем показ машин здесь, нужно просто удалить из списка ниже, тогда включится $(".carChooseImgs_elem").eq(2).hide(); // небольшая $(".carChooseImgs_elem").eq(0).hide(); // небольшая центр $(".carChooseImgs_elem").eq(12).hide(); // пирамида $(".carChooseImgs_elem").eq(1).hide(); // завышенная центр $(".carChooseImgs_elem").eq(13).hide(); // Ивеко до 4 тонн--> $(".carChooseImgs_elem").eq(10).hide(); // 6м--> //ff = 'ff';//this.geoObjects.get(0).getAddressLine(); $('#ff').html('0'); $('#dopprice').html('0'); //if (!myPolygons.geometry.contains(start)) { if (proh == 0) { if(myPolygons.geometry.contains(start)){ $('#ff').html('0'); $('#dopprice').html('0'); } else { if(myPolygon.geometry.contains(start)){ $('#dopprice').html('0'); $('#ff').html('0'); }else{if (myPolygonthree.geometry.contains(start)) {$('#ff').html('0'); }else{if (myPolygonfive.geometry.contains(start)) {$('#ff').html('0'); }else{if (myPolygonfour.geometry.contains(start)) {$('#ff').html('0'); }else{ $('#ff').html('0'); if (myPolygonfour.geometry.contains(start) && myPolygonfour.geometry.contains(finish)) {$('#ff').html('0');} } //$("#car").val(2); //document.getElementById("car").disabled="disabled"; //$('#car').val(3).change(); // $('#car').change(); //$('#ff').html('0'); } }} if(myPolygonfour.geometry.contains(finish)) {$('#ff').html('0');} $('#dopprice').html('0');}}//} //$('#car').val('0'); $('#price').html('0'); $('#times').html(''); if(myPolygonfour.geometry.contains(finish) && myPolygonthree.geometry.contains(start)) {$('#ff').html('0');} if(myPolygonfour.geometry.contains(start) && myPolygonthree.geometry.contains(finish)) {$('#ff').html('0');} if(myPolygonfour.geometry.contains(finish) && myPolygonfive.geometry.contains(start)) {$('#ff').html('0');} if(myPolygonfour.geometry.contains(start) && myPolygonfive.geometry.contains(finish)) {$('#ff').html('0');} if (myPolygonfour.geometry.contains(start)) {if (!myPolygons.geometry.contains(finish)) {if (!myPolygonthree.geometry.contains(finish)) {if (!myPolygonfive.geometry.contains(finish)) {$('#ff').html('0');}}} } setTimeout(function(){},1000); setTimeout(function(){$(".carChooseImgs_elem.active").click();},1500); //document.getElementById('car').value = '0'; // ; //$('#ff').html(ff); var str = []; ymaps.geocode(start).then(function (res) { var firstGeoObject = res.geoObjects.get(0); str[0] = firstGeoObject.getAddressLine(); }); ymaps.geocode(finish).then(function (res) { var firstGeoObject = res.geoObjects.get(0); str[1] =firstGeoObject.getAddressLine(); }); for(i=0;i